'use strict';

describe('Controller: MainCtrl', function () {

    // load the controller's module
    beforeEach(module('mytodoApp'));

    var MainCtrl,
        scope;

    // Initialize the controller and a mock scope
    beforeEach(inject(function ($controller, $rootScope) {
        scope = $rootScope.$new();
        MainCtrl = $controller('MainCtrl', {
            $scope: scope
            // place here mocked dependencies
        });
    }));

    //it('should attach a list of awesomeThings to the scope', function () {
    //  expect(MainCtrl.awesomeThings.length).toBe(3);
    //});

    // 测试初始todo是否是空
    it('should have no items to start', function () {
        expect(scope.todos.length).toBe(0);
    });

    // 测试添加todo
    it('should add items to the list', function () {
        scope.todo = 'test 1';
        scope.addTodo();
        expect(scope.todos.length).toBe(1);
    });

    // 测试移除todo
    it('should add items to the list', function () {
        scope.todo = 'test 1';
        scope.addTodo();
        scope.removeTodo(0);
        expect(scope.todos.length).toBe(0);
    });


});
